import Tape

class Transition(dict):
    def __bool__(self):
#         instructions = None
#         for state in self:
#                 if self[state]:
#                         if instructions:
#                                 if set(self[state].keys()) != instructions:
#                                         return False
#                         else:
#                                 instructions = set(self[state].keys())
        for state in self:
                if self[state]:
                        for instruction in self[state]:
                                s, v, m = self[state][instruction]
                                if s not in self.keys():
                                        return False
#                                 if v not in instructions:
#                                         return False
                                if m not in (Tape.Tape.LEFT, Tape.Tape.RIGHT, Tape.Tape.NO_MOVE):
                                        return False
                